function [x,y,typ]=anahpf_int(job,arg1,arg2)
  //analog high pass filter
x=[];y=[];typ=[]
select job
case 'plot' then
    standard_draw(arg1)
case 'getinputs' then
	[x,y,typ]=standard_inputs(arg1)
case 'getoutputs' then
	[x,y,typ]=standard_outputs(arg1)
case 'getorigin' then
	[x,y]=standard_origin(arg1)
case 'set' then
	x=arg1;
	graphics=arg1.graphics;exprs=graphics.exprs
	model=arg1.model;
	x0=model.state
	rpar=model.rpar
	ns=prod(size(x0));nin=1;nout=1
	s=poly(0,'s');z=poly(0,'s')
	while %t do
      [ok, order, filterType, passRp, stopRp,omega, plot_bode, exprs]=getvalue(..
          'Set analog high pass filter parameters',..
          ['order';
          'filter prototype,input: 0(butt),1(cheb1),2(cheb2),3(ellip)';
          'passband ripple';
          'stopband ripple';
          'cutoff frequency(in radius)';
          'whether plot bode: (0 for no, positive number for yes)';
          ],..
          list('vec',1,'vec',1, 'vec',1,'vec',1, 'vec',1,'vec',1),exprs);
        
      if ~ok then break,end
      
      order = ceil(order);
      filterType = round(filterType);
      if order < 1 then
        message('Order of the filter must a be positive integer')
        ok=%f
      elseif (filterType > 3 | filterType < 0) then
        message('Type of the filter must be 0,1,2 or 3')
        ok=%f
      elseif (passRp < 0 | passRp > 1) then
        message('Ripple must between 0 and 1')
        ok=%f
      elseif (stopRp < 0 | stopRp > 1) then
        message('Ripple must between 0 and 1')
        ok=%f
      elseif (omega <= 0) then
        message('cutoff frequency must be positive')
        ok=%f
      end
      if ok then
        select filterType
          case 0 then fdesign = 'butt'
          case 1 then fdesign = 'cheb1'
          case 2 then fdesign = 'cheb2'
          case 3 then fdesign = 'ellip'
        end
        hs_low = analpf(order, fdesign, [passRp stopRp], 1);
        hs = analogTrans(hs_low, 1, 'hp', omega);
        //message(["transfer function of the filter:";  pol2str(hs(2)/hs(3))]);
        if plot_bode<>0 then
          message(["transfer function of the filter:";pol2str(hs(2));"/" ;pol2str(hs(3))])
          win=xget("window")
          xset("window",int(plot_bode))
          xset("wdim",300,200)
          xbasc()
          temp = floor(log10(omega))   
          temp = 10^temp;
          affiche_bode(int(plot_bode),temp/100,temp*100,hs(2),hs(3));
          xset("window",win);
        end
      
        H=cont_frm(hs(2),hs(3))
        [A,B,C,D]=H(2:5);      			
        graphics.exprs=exprs;
        [ns1,ns1]=size(A)
        rpar=[matrix(A,ns1*ns1,1);
              matrix(B,ns1,1);
              matrix(C,ns1,1);
              D]
        if norm(D,1)<>0 then
          mmm=[%t %t];
        else
          mmm=[%f %t];
        end
        if or(model.dep_ut<>mmm) then 
          model.dep_ut=mmm,end
        if ns1<=ns then
          x0=x0(1:ns1)
        else
          x0(ns1,1)=0
        end
          model.state=x0
          model.rpar=rpar
          x.graphics=graphics;x.model=model
        break
      end // if ok
	end // while loop
case 'define' then
		x0=0;A=-1;B=1;C=1;D=0;
		exprs=['1';'0';'0.1';'0.1';'2';'0']
		model=scicos_model()
		model.sim=list('csslti4',4)
		model.in=1
		model.out=1
		model.state=x0
		model.rpar=[A(:);B(:);C(:);D(:)]
		model.blocktype='c'
		model.dep_ut=[%f %t]

		gr_i=['xstringb(orig(1),orig(2),[''analog high'';''pass filter''],sz(1),sz(2),''fill'')']

		x=standard_define([2.5 2.5],model,exprs,gr_i)
end
endfunction
